#!/bin/bash
set -e

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BIN="$ROOT/bin/gateway_beast_http"

echo "========================================="
echo "  启动 Gateway (Boost.Beast HTTP)"
echo "========================================="

if [ ! -x "$BIN" ]; then
  echo "未找到可执行文件: $BIN"
  echo "请先编译: make gateway_beast_http"
  exit 1
fi

if ! redis-cli ping >/dev/null 2>&1; then
  echo "Redis 未运行，请先启动: redis-server --daemonize yes"
  exit 1
fi

"$BIN"

